<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
      
<h:head>
	<title>Create Package</title>
</h:head>


<body>
	<h:form>
	 <p:menubar>  
        <p:submenu label="Packages Section" icon="ui-icon-gear">
          	<p:menuitem value="Index" icon="ui-icon-refresh" url="indexPackages.xhtml" />
            <p:separator />
            <p:menuitem value="Create Package" icon="ui-icon-contact" url="createPackage.xhtml"/>  
            <p:separator />
            <p:menuitem value="Search Package" icon="ui-icon-search" url="searchPackage.xhtml" />            
       </p:submenu>  
       <p:submenu label="Basic Products Section"  icon="ui-icon-gear">
            <p:menuitem value="Index" url="indexBasicProduct.xhtml" icon="ui-icon-refresh" />  
            <p:separator />  
            <p:menuitem value="Create Basic Product" icon="ui-icon-contact" url="createBasicProduct.xhtml" /> 
            <p:separator /> 
            <p:submenu label="Search Basic Product" icon="ui-icon-search" > 
            	<p:menuitem value="Search Residences" url="residences.xhtml" /> 
            	<p:menuitem value="Search Transports"  url="transports.xhtml" /> 
            	<p:menuitem value="Search Excursions" url="excursions.xhtml" /> 
            </p:submenu>
       </p:submenu>
     
        <f:facet name="options">  
              <p:commandButton type="submit" ajax="false" action = "createPackage" value="Go To The Package!" icon="ui-icon-gear" />
            <p:commandButton type="submit" ajax="false" action = "#{logoutBean.logout()}" value="Logout" icon="ui-icon-extlink" />  
        </f:facet>
       
       </p:menubar>
        </h:form>
	
	<p:panel header="Choose!">
	<br/><h:link outcome = "createBasicProduct" value = "Create Product To Insert!"/>    
	<br/><h:link outcome = "indexBasicProduct" value = "Search Product To Insert!"/>
	
	</p:panel>
	
	
	<h:form>
		<p:commandButton disabled="#{!packageCreation.cMgr.isComplete(packageCreation.currentPackage) || 
		packageCreation.isCurrentInDatabase() || 
		packageCreation.cMgr.existsOneNotDisponible(packageCreation.currentPackage) }" 
		value="Create Package" ajax="false" action="#{packageCreation.createPackage()}" type="submit" />
		
		<p:commandButton disabled="#{!packageCreation.isCurrentInDatabase() }" 
		value="Update Package"  action="#{packageCreation.updatePackage()}" type="submit" ajax="false" />
		<p:commandButton  value="Reset Package"  action="#{packageCreation.resetCurrentPackage()}" type="submit" ajax="false" />
		
	
	
	<p:panel header="General Details">
	        <h:panelGrid id="genGrid" columns="3" >
	        
					<h:outputLabel for="available">Available*:</h:outputLabel>
					<p:selectBooleanCheckbox id="available" value="#{packageCreation.currentPackage.available}" />
					<h:message for="available" />
	
					<h:outputLabel for="disponibility">Disponibility*:</h:outputLabel>
					<p:spinner id="disponibility"   
                    value="#{packageCreation.currentPackage.disponibility}" 
                    min="0" max="#{packageCreation.maxValueForNewPackage()}"
                    default="1"/>  
					<h:message for="disponibility" />
	

					<h:outputLabel for="discount">Discount(%)*:</h:outputLabel>
					<p:spinner id="discount" 
                    value="#{packageCreation.currentPackage.discount}" 
                    min="0" max="100"/>  
					<h:message for="discount" />
					
					<h:outputLabel for="price">Price*:</h:outputLabel>					
					<h:inputText value="#{packageCreation.currentPackage.price}" id= "price" />
		
		</h:panelGrid>
	</p:panel>	
</h:form>


		<p:panel header="Residence Details">
	        <h:panelGrid id="resGrid" columns="2" >   
	   
				<h:outputLabel>Available*:</h:outputLabel>
				<p:selectBooleanCheckbox value="#{packageCreation.currentPackage.residence.available}" disabled="true" />
			
	
				<h:outputLabel>Price*:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.price}" />
			
				
			
				<h:outputLabel>Residence Type*:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.type}" />  
				
				
				
				<h:outputLabel>Name*:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.residenceName}" /> 
				
				<h:outputLabel>City*:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.city}" /> 
				
				<h:outputLabel>Country*:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.country}" />
				
	
				<h:outputLabel>Address*:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.address}" />
		
				<h:outputLabel>From*:</h:outputLabel>
				<p:calendar value="#{packageCreation.currentPackage.residence.fromDate}" disabled="true" />
				
		
				<h:outputLabel>To*:</h:outputLabel>
				<p:calendar value="#{packageCreation.currentPackage.residence.toDate}" disabled="true"/>
				
		
		
				<h:outputLabel >Site:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.site}"/> 
		
	
				<h:outputLabel>Phone:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.phoneNumber}"/>
		
	
				<h:outputLabel>Rooms*:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.rooms}"/> 
		
				<h:outputLabel>Beds*:</h:outputLabel>
				<h:outputText value="#{packageCreation.currentPackage.residence.rooms}"/>
			
				<h:outputLabel>Stars:</h:outputLabel>
				<p:rating value="#{packageCreation.currentPackage.residence.stars}" disabled="true"/>  
	  
	   
	        </h:panelGrid> 
	     </p:panel> 


		<p:panel header=" Departure Transport Details">
	        <h:panelGrid id="depTransGrid" columns="2" >   
	   
								
					<h:outputLabel>Available*:</h:outputLabel>
					<p:selectBooleanCheckbox 
					value="#{packageCreation.currentPackage.departureTransport.available}" disabled="true"/>
					
	
					
					<h:outputLabel>Price*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.departureTransport.price}"/>
					

					<h:outputLabel>Transport Type*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.departureTransport.type}" />
				
		
					<h:outputLabel>Number of Passengers*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.departureTransport.passengers}" />

					<h:outputLabel>Class*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.departureTransport.classNumber}" />
	
					<h:outputLabel>From (Place)*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.departureTransport.fromPlace}" />
	
					<h:outputLabel>To (Place)*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.departureTransport.toPlace}" />
	
					<h:outputLabel>Departure Date*:</h:outputLabel>
					<p:calendar value="#{packageCreation.currentPackage.departureTransport.departureDate}" disabled="true"  />
				
	
					<h:outputLabel>Departure Time*:</h:outputLabel>
					<p:calendar value="#{packageCreation.currentPackage.departureTransport.departureTime}"  pattern="HH:mm" timeOnly="true" disabled="true" />					
					
					<h:outputLabel>Departure Company:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.departureTransport.company}" />
					
					<h:outputLabel>Flight ID:</h:outputLabel>
					<h:outputText  value="#{packageCreation.currentPackage.departureTransport.flightId}" />
				
	        </h:panelGrid> 
	     </p:panel> 
	     

		<p:panel header="Return Transport Details">
	        <h:panelGrid id="retTransGrid" columns="2" >   
	   
								
					<h:outputLabel>Available*:</h:outputLabel>
					<p:selectBooleanCheckbox  
					value="#{packageCreation.currentPackage.returnTransport.available}" disabled="true"/>
					
	
					<h:outputLabel>Price*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.returnTransport.price}" />
					

					<h:outputLabel>Transport Type*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.returnTransport.type}" />
				
		
					<h:outputLabel>Number of Passengers*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.returnTransport.passengers}" />

					<h:outputLabel>Class*:</h:outputLabel>
					<h:outputText id="classNumber" value="#{packageCreation.currentPackage.returnTransport.classNumber}"/>
	
					<h:outputLabel>From (Place)*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.returnTransport.fromPlace}" />
	
					<h:outputLabel>To (Place)*:</h:outputLabel>
					<h:outputText  value="#{packageCreation.currentPackage.returnTransport.toPlace}" />
	
					<h:outputLabel>Departure Date*:</h:outputLabel>
					<p:calendar value="#{packageCreation.currentPackage.returnTransport.departureDate}" disabled="true"  id="departureDate" />
				
	
					<h:outputLabel>Departure Time*:</h:outputLabel>
					<p:calendar value="#{packageCreation.currentPackage.returnTransport.departureTime}"  disabled="true" pattern="HH:mm" timeOnly="true" />					
					
					<h:outputLabel>Departure Company:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.returnTransport.company}" />
					
					<h:outputLabel>Flight ID:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.returnTransport.flightId}" />
				
	        </h:panelGrid> 
	     </p:panel> 

	     

		<p:panel header=" Excursion Details">
	        <h:panelGrid id="excGrid" columns="2" > 
	          
					<h:outputLabel>Available*:</h:outputLabel>
					<p:selectBooleanCheckbox value="#{packageCreation.currentPackage.excursion.available}" disabled="true" />
					
						
					<h:outputLabel>Price*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.excursion.price}"/>
			
					<h:outputLabel>Type*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.excursion.type}" />
			
					<h:outputLabel>Description*:</h:outputLabel>
					<h:outputText value="#{packageCreation.currentPackage.excursion.description}" rows="6" cols="33" />
			
					<h:outputLabel >Date*:</h:outputLabel>
					<p:calendar value="#{packageCreation.currentPackage.excursion.date}"  disabled="true"/>
		
					<h:outputLabel>Start Time*:</h:outputLabel>
					<p:calendar value="#{packageCreation.currentPackage.excursion.startTime}"  pattern="HH:mm" timeOnly="true" disabled="true"/>
		
					<h:outputLabel>End Time*:</h:outputLabel>
					<p:calendar value="#{packageCreation.currentPackage.excursion.endTime}"  pattern="HH:mm" timeOnly="true" disabled="true"/>
								
					
	        </h:panelGrid> 
	     </p:panel> 
	
</body>
</html>